package com.zjp.demo02251.exception;

import com.zjp.demo02251.enums.ResultEnum;

/**
 * @author james
 * @Title: CompanyUserExcption
 * @Package com.zjp.demo02251
 * @Description:  统一异常处理
 * @date 2018/2/25  20:34
 */
//原因1.public class RuntimeException extends Exception  RuntimeException可以回滚所以才用它
//原因2.Exception只接受一个文本参数，不接受错误码，所以需要从新封装一层；
public class CompanyUserExcption extends RuntimeException {


    private Integer code;

    public CompanyUserExcption(ResultEnum resultEnum) {
        //
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }
}
